<?php

use App\Api\Controllers\ProductController;
use App\Api\Controllers\UserController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:sanctum')->get('/ceshi', function (Request $request) {
    return $request->user();
});

Route::post('/user/register', [UserController::class, 'register']);
Route::post('/user/login', [UserController::class, 'login']);




Route::group(['middleware' => 'auth.jwt'], function () {


    Route::get('user/getUser', [UserController::class,'getUser']);

    Route::post('product/store', [ProductController::class,'store']);
    Route::get('product/index', [ProductController::class,'index']);
    Route::get('product/show/{id}', [ProductController::class,'show']);
    Route::put('product/update/{id}', [ProductController::class,'update']);
    Route::delete('product/destroy/{id}', [ProductController::class,'destroy']);

});
